from classes.helper import*

oHelper= helper()




class policeman:

    potentialCatchArr=[]
    ID = 0

    # This is constructor of policeman Class
    def __init__(self, id):

        self.potentialCatchArr=[]
        self.ID = policeNum


    






pol=[]
thi=[]
i=0
thiefNum=0
policeNum=0
polCatch=[]
res=0
crowd = ['P', 'P','T','T','T','T','T','T','P','P','T','T','T','T','T','T','T','T','T','T','T','T','P','T','P', 'T', 'T','P','P','P','P','P','T', 'P']
k = 6
n = len(crowd)


oPolice = policeman(120)
print(str(oPolice))

while i < n: 
    if crowd[i] == 'P': 
        pol.append(i) 
    elif crowd[i] == 'T': 
        thi.append(i) 
    i += 1
print('police number are',pol,'thief number are',thi)

polCollection=[]
dis = abs(thi[thiefNum]-pol[policeNum])
for policeNum in range(0,len(pol)):
##    if thiefNum==len(thi)-1:
##                policeNum+=1
##                polCatch.append(res)
##                res=0
##                thiefNum=0


    oPol=policeman(policeNum)


    
    for thiefNum in range(0,len(thi)):
        if (abs(thi[thiefNum]-pol[policeNum])<=k):
            res+=1
            oPol.potentialCatchArr.append(thiefNum)
    print('police number',policeNum+1,'can arrest',res,'thieves')    
    polCollection.append(oPol)      
    res=0    
print(res)
print(polCatch)

i=0
for pol in polCollection:
    print("pol number ",pol.ID,' has ',len(pol.potentialCatchArr),' theif numbers')
    print(pol.potentialCatchArr)
##print("pol data "+str(i)+' has '+str(len(polCollection[i].potentialCatchArr))+' theif numbers')
##print(polCollection[i].potentialCatchArr)
##
##i=8
##print("pol data "+str(i)+' has '+str(len(polCollection[i].potentialCatchArr))+' theif numbers')
##print(polCollection[i].potentialCatchArr)
##
##i=10
##print("pol data "+str(i)+' has '+str(len(polCollection[i].potentialCatchArr))+' theif numbers')
##print(polCollection[i].potentialCatchArr)
##
##i=11
##print("pol data "+str(i)+' has '+str(len(polCollection[i].potentialCatchArr))+' theif numbers')
##print(polCollection[i].potentialCatchArr)
##if (abs( thi[thiefNum] - pol[policeNum] ) <= k):
##    print("police no."+str(policeNum)+" catches thief no."+str(thiefNum))
##    res += 1
##    thiefNum += 1
##    policeNum += 1
